package kuzha.runtime;

public class KzFloat32 extends KzFloat {
	public static KzFloat32 valueOf(float num) {
		return new KzFloat32(num);
	}
	
	public final float value;
	
	protected KzFloat32(float value) {
		this.value = value;
	}
	
	@Override
	public boolean isTrue() {
		return value != 0;
	}
	
	@Override
	public Object toJavaObject() {
		return value;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + Float.floatToIntBits(value);
		return result;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final KzFloat32 other = (KzFloat32) obj;
		if (Float.floatToIntBits(value) != Float.floatToIntBits(other.value))
			return false;
		return true;
	}
	
	@Override
	public Number getNumber() { return value; }
	@Override
	public String toString() { 	return Float.toString(value); }
	@Override
	public String toHexString() { return Float.toHexString(value); }
}
